package com.hui;

import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.core.SkipListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class MySkipListener implements SkipListener<String, String> {
    /**
     * read阶段skip
     * @param t
     */
    @Override
    public void onSkipInRead(Throwable t) {
        log.info("\n\rMySkipListener.onSkipInRead:{}", t.getMessage());
    }

    /**
     * write阶段skip
     * @param item
     * @param t
     */
    @Override
    public void onSkipInWrite(String item, Throwable t) {
        log.info("\n\rMySkipListener.onSkipInWrite:{}, {}", item, t.getMessage());
    }

    /**
     * 处理阶段skip
     * @param item
     * @param t
     */
    @Override
    public void onSkipInProcess(String item, Throwable t) {
        System.out.println("MySkipListener.onSkipInProcess " + item + "," + t.getMessage());
        log.info("\n\rMySkipListener.onSkipInProcess:{}, {}", item, t.getMessage());
    }
}
